<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class FirmBrandProfile extends Model
{
    protected $fillable = [
        'brand_id',
        'banners',
        'video_url',
        'store_num',
        'set_up_time',
        'cooperation_area',
        'manage_method',
        'invest_crowd',
        'tags',
        'cover_one',
        'cover_two',
        'intro',
        'advantage',
        'contact',
        'is_invest_price',
        'is_join_price',
        'start_invest_amount',
        'end_invest_amount',
        'start_join_in_fee',
        'end_join_in_fee',
    ];


    protected $attributes = [
        'video_url' => '',
        'is_invest_price' => 2,
        'is_join_price' => 2,
        'start_invest_amount' => 0,
        'end_invest_amount' => 0,
        'start_join_in_fee' => 0,
        'end_join_in_fee' => 0,
    ];

    protected $casts = [
        'banners' => 'array',
        'tags' => 'array',
        'cooperation_area' => 'array',
        'contact' => 'array',
        'video_url' => 'string',
        'start_invest_amount' => 'int',
        'end_invest_amount' => 'int',
        'start_join_in_fee' => 'int',
        'end_join_in_fee' => 'int',
    ];


    public function getIntroAttribute($value)
    {
        return str_replace("<img ", "<img style='width:100%;height:100%;vertical-align:middle;' ",$value);
    }


    public function getAdvantageAttribute($value)
    {
        return str_replace("<img ", "<img style='width:100%;height:100%;vertical-align:middle;' ",$value);
    }




}
